<%= form_for [:admin, @parameter], :validate => true do |f| %>

<%= render "shared/error_messages", :target => @parameter %>

<table>
  <tbody>
    <tr>
      <th><%= f.label :presentation %></th>
      <td colspan="4"><%= f.text_field :presentation, :maxlength => 30, :size => 40 %></td>
    </tr>
    <tr>
      <th><%= f.label :name %></th>
      <td colspan="4"><%= f.text_field :name, :maxlength => 30, :size => 40 %></td>
    </tr>
    <tr>
      <th><%= f.label :searchable %></th>
      <td colspan="4"><%= f.check_box :searchable %></td>
    </tr>
    <%= f.fields_for :explanation_note do |explanation| %>
    <tr>
      <th><%= explanation.label :note %></th>
      <td colspan="4">
          <%= explanation.text_area :note, :style => "height: 60px;" %>
          <%= explanation.hidden_field :type, :value => 'Parameter' %>
      </td>
    </tr>
    <% end %>
    <tr>
      <th colspan="5">Hodnoty parametru</th>
    </tr>

    <%= f.fields_for :parameter_values, :validate => false do |pv| %>
      <%= render "form_parameter_values", :f => pv %>
    <% end %>
    
    <% permitted_to? :create, :admin_parameter_values do %>
      <tr>
        <th colspan="5"><%= link_to_add_fields "Přidat hodnotu parametru", f, :parameter_values %></th>
      </tr>
    <% end %>
    <tr>
      <td colspan="3"><%= f.submit %></td>
    </tr>
  </tbody>
</table>
<% end %>